The invention relates to data processing in a graphics system, and in particular, to real-time physically-based shading on SIMD (Single Instruction Multiple Data) architectures.
With the advent of 3D graphics processors capable of per-pixel shading effects, focus has been shifting towards providing more advanced rendering techniques.
In recent years, much emphasis has been placed upon improving the speed of 3D graphics hardware. The focus has been to increase the number of polygons, the number of texels and so on. More recently, a trend has emerged to attempt to improve the quality of interactive 3D graphics, for example, by improving rendering techniques.
Traditionally, photo-realistic rendering has been the preserve of off-line rendering systems. However, more recently, these techniques have started to be used in contemporary interactive systems. Many of these techniques use the power of the texturing hardware to provide the desired functionality. For example, Cabral, et al., xe2x80x9cReflection Space Image Based Rendering, SIGGRAPH 99, conference proceedings, pages 165-170, and Heidrich et al., xe2x80x9cRealistic, Hardware-accelerated Shading and Lighting, SIGGRAPH 99, Conference proceedings, pages 171-178, both demonstrate how effective this can be. The Cabral technique implements Bidirectional Reflection Distribution Functions (BRDF) using environment mapping hardware. Heidrich, on the other hand, uses multipass methods supported by current hardware to implement physically-based reflection models.
One example of a well known reflection model of a surface is the Phong model.
Another example of a well known physically-based reflection model is the Cook-Torrance model. This model is based on a previous model, known as the Torrance-Sparrow model, which describes a method that accounts for directional distribution of reflected light from roughened surfaces, simulated using microfacets.
Microfacets are assumed to be an isotropic collection of planar microscopic facets, each defined as a perfectly smooth reflector.
For the Cook-Torrance model, the specular component of bi-directional reflectivity is expressed as:       ρ    s    =                    F        λ            π        ⁢          DG                        (                                    N              _                        ·                          V              _                                )                ⁢                  (                                    N              _                        ·                          L              _                                )                    
where,
Fxcex=Fresnel term, relating incident light to reflected light
D=Distribution function for microfacets
G=Geometrical attenuation factor, the masking and shadowing effects of the microfacets on each other.
{overscore (N)}=Surface normal
{overscore (V)}=Viewpoint vector
{overscore (L)}=Light vector
In the above model, several known functions can be used to provide the microfacet distribution function, D. These include a Gaussian distribution; a Trowbridge-Reitz distribution and a Beckmann distribution. The Beckmann distribution is considered to be particularly advantageous because it provides the absolute magnitude of the reflectance without introducing arbitrary constants.
The Beckmann distribution function for rough surfaces is given as:   D  =            1              4        ⁢                  m          2                ⁢                  cos          4                ⁢        β              ⁢          ⅇ              -                              (                                          tan                ⁢                                  xe2x80x83                                ⁢                β                            m                        )                    2                    
where,
m=Root mean square slope of microfacets
xcex2=Angle between {overscore (N)} and {overscore (H)}, where {overscore (H)} is the half vector between {overscore (V)} and {overscore (L)}.
The value of xe2x80x9cmxe2x80x9d is basically an indication of the smoothness or roughness of a surface. It ranges between 0 and 1, with smooth surfaces having low values of m, and rough surfaces having high values of m.
The Beckmann distribution function suffers from the disadvantage that it is not particularly suited for real-time implementation, since it is relatively expensive to compute, and it must be computed for each pixel that is being considered for shading. In particular, the cosine and tan functions require a relatively large number of instruction cycles to compute. This means that the Beckmann distribution function is not particularly suited for use on a SIMD architecture.
The computation power required to compute the Cook-Torrance reflectance model is further hampered by the Fresnel term, F, which is also expensive in terms of the number of instruction cycles required to calculate the term.
The Fresnel equation relates incident light to reflected light for the smooth surface of each microfacet. The Fresnel equation can be expressed as:       F    λ    =            1      2        ⁢                  1        ⁢                              (                          g              -              c                        )                    2                            2        ⁢                              (                          g              +              c                        )                    2                      ⁢          (              1        +                                            (                                                c                  ⁢                                      (                                          g                      +                      c                                        )                                                  -                1                            )                        2                                              (                                                c                  ⁢                                      (                                          g                      -                      c                                        )                                                  +                1                            )                        2                              )      
where,
c=cos xcex8ixc2x7{overscore (L)}xc2x7{overscore (H)}
g2=xcex7xcex2+c2xe2x88x921
      η    λ    =                    η        t            ⁢      λ                      η        i            ⁢      λ      
where, xcex7txcex and xcex7ixcex are the indices of refraction of the two media.
As with the Beckmann distribution function mentioned above, the Fresnel term is also unsuited for real time calculations.
Thus, although known methods exist for offering improved shading techniques, they are not particularly suited for real-time calculations, or for use on a conventional SIMD architecture.
Therefore, the aim of the present invention is to provide an approximation technique, which can be used to provide a physically-based shading technique that requires less computation than known techniques, and which is suited for use on a SIMD architecture.
According to a first aspect of the present invention, there is provided method of determining shading values in a graphics processing system using an approximation of a Beckmann Distribution Function (BDF), the BDF being defined as:   D  =            1              4        ⁢                  m          2                ⁢                  cos          4                ⁢        β              ⁢          ⅇ              -                              (                                          tan                ⁢                                  xe2x80x83                                ⁢                β                            m                        )                    2                    
where,
m=Root mean square slope of microfacets
xcex2=Angle between {overscore (N)} and {overscore (H)}
the method comprising the steps of:
(a) reformulating the BDF in terms of the scalar product of the surface normal {overscore (N)} and the viewpoint-light half-vector {overscore (H)} ({overscore (N)}xc2x7{overscore (H)}) to produce a modified BDF;
(b) dividing a portion of the BDF into a plurality of intervals, n, each interval defined by first and second control points at its boundaries; and,
(c) approximating each interval using a cubic approximation to produce coefficients for use in determining the shading values.
According to another aspect of the present invention, there is provided a method of determining shading values in a graphics processing system using a Cook-Torrance model, the Cook Torrance model being:       ρ    s    =                    F        λ            π        ⁢          DG                        (                                    N              _                        ·                          V              _                                )                ⁢                  (                                    N              _                        ·                          L              _                                )                    
where,
Fxcex=Fresnel term, relating incident light to reflected light
D=Distribution function for microfacets
G=Geometrical attenuation factor, the masking and shadowing effects of the microfacets on each other.
{overscore (N)}=Surface normal
{overscore (V)}=Viewpoint vector
{overscore (L)}=Light vector
the method comprising the steps of:
receiving data for a material being modelled;
approximating the microfacet distribution function D using a piecewise cubic interpolation of the distribution function; and,
calculating the Cook-Torrance model using the approximation of the microfacet distribution function.
According to another aspect of the present invention, there is provided a method of determining shading values in a graphics processing system using an approximation of a microfacet distribution function, the method comprising the steps of:
(a) dividing a portion of the microfacet distribution function into one or more intervals, n, each interval defined by first and second control points at its boundaries; and,
(b) approximating each interval using a polynomial approximation to produce coefficients for use in determining the shading values.
According to another aspect of the invention, there is provided a graphics processing system having means for determining shading values using an approximation of a Beckmann Distribution Function (BDF), the BDF being defined as:   D  =            1              4        ⁢                  m          2                ⁢                  cos          4                ⁢        β              ⁢          ⅇ              -                              (                                          tan                ⁢                                  xe2x80x83                                ⁢                β                            m                        )                    2                    
where,
m=Root mean square slope of microfacets
xcex2=Angle between {overscore (N)} and {overscore (H)}
the graphics processing system comprising:
(a) reformulating means for reformulating the BDF in terms of the scalar product of the surface normal and the viewpoint-light half-vector ({overscore (N)}xc2x7{overscore (H)}) to produce a modified BDF;
(b) dividing means for dividing a portion of the BDF into a plurality of intervals, n, each interval defined by first and second control points at its boundaries; and,
(c) approximating means for approximating each interval using a cubic approximation to produce coefficients for use in determining the shading values.
According to another aspect of the invention, there is provided a graphics processing system for determining shading values using a Cook-Torrance model, the Cook Torrance model being:       ρ    s    =                    F        λ            π        ⁢          DG                        (                                    N              _                        ·                          V              _                                )                ⁢                  (                                    N              _                        ·                          L              _                                )                    
where,
Fxcex=Fresnel term, relating incident light to reflected light
D=Distribution function for microfacets
G=Geometrical attenuation factor, the masking and shadowing effects of the microfacets on each other.
{overscore (N)}=Surface normal
{overscore (V)}=Viewpoint vector
{overscore (L)}=Light vector
the graphics processing system comprising:
receiving means for receiving data for a material being modelled;
approximating means for approximating the microfacet distribution function D using piecewise cubic interpolation of the distribution function; and,
calculating means for calculating the Cook-Torrance model using the approximation of the microfacet distribution function.
According to another aspect of the present invention, there is provided a graphics processing system having means for determining shading values using an approximation of a microfacet distribution function, the graphics processing system comprising:
(a) dividing means for dividing a portion of the microfacet distribution function into one or more intervals, n, each interval defined by first and second control points at its boundaries; and,
(b) approximating means for approximating each interval using a polynomial approximation to produce coefficients for use in determining the shading values.